
function fecthLogin(userid, userpw, cb) {
    $.post('http://api.juzhen.net/admin/login', { userid: userid, userpw: userpw }, function (data) {
        if (cb) cb(data);
    })
}

function fecthRegister(userid, userpw) {
    $.post('http://api.juzhen.net/admin/register', { userid: userid, userpw: userpw }, function () {

    })
}

function downTable(name) {
    var url = 'http://api.juzhen.net/admin/downtable?tableName=' + name + '&token=' + localStorage.getItem('local_token') + '&uid=123';

    location.href = url
}

// 登陆
$('#loginBtn').click(function () {
    fecthLogin('xiexiaofei', 'xiexiaofei', function (data) {
        localStorage.setItem('local_token', data.token)

        downTable('checkin');
    });
})